package com.huage_06.lesson_03;

import java.util.TreeSet;

public class TreeSetDemo {
    public static void main(String[] args) {
        TreeSet<Student> tSet = new TreeSet<Student>();

        Student std1 = new Student("张三",23);
        Student std2 = new Student("李四",24);
        Student std3 = new Student("王五",25);
        Student std4 = new Student("王二",25);

        tSet.add(std1);
        tSet.add(std2);
        tSet.add(std3);
        tSet.add(std4);

        for (Student s : tSet){
            System.out.println(s.getName()+","+s.getAge());
        }
    }
}
